package jmu.edu.yjc.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import jmu.edu.yjc.domain.ResponseResult;
import jmu.edu.yjc.service.UpLoadService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

@RestController
@Api(description = "上传头像有关接口")
public class UpLoadController {
    @Resource
    private UpLoadService upLoadService;
    @PostMapping("/upload")
    @ApiOperation(value = "上传头像")
    @ApiImplicitParam(name = "img",value = "前端传来图像")
    public ResponseResult uploadImg(@RequestParam("img") MultipartFile multipartFile) throws IOException {
        return upLoadService.uploadImg(multipartFile);
    }
}
